import dash
from dash import dcc, html  # dcc dash核心组件，html HTML组件

app = dash.Dash(__name__)

app.layout = html.Div(
    children=[
        html.H1(children="hello Dash"),
        html.Div(children="Dash: A web application framework for Python"),
        html.Div(children="Dash: 一个用于Python的web应用程序框架"),
        dcc.Graph(
            id="example-graph",  # 图表id, 用于回调函数
            figure={
                "data": [
                    {"x": [1, 2, 3], "y": [4, 1, 2], "type": "bar", "name": "上海"},
                    {"x": [1, 2, 3], "y": [2, 4, 5], "type": "bar", "name": "北京"},
                ],
                "layout": {"title": "Dash Data Visualization 数据可视化示例"},
            },
        ),
    ]
)

if __name__ == "__main__":
    # app.run_server(debug=True)
    app.run(debug=True, port=8090)
